<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>儿童版管理</title>
<link href="css/sytle.css" rel="stylesheet" type="text/css" />
<script src="js/jquery-1.7.1.min.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
	$(document).ready(function() {
		getTaskList();
	});
	function getTaskList() {
		var url = "getTaskList";

		$.getJSON(url, null, function callback(data) {
			$.each(data, function(i, n) {
				var row = $("#taskList").clone();
				row.find("#id").text(n.id);
				row.find("#group").text(n.group);
				row.find("#datetime").text(n.datetime);
				row.find("#work").text(n.work);
				row.find("#workers").text(n.workers);
				row.find("#info").text(n.info);
				row.find("#commont").text(n.commont);
				row.find("#state").text(n.state);
				<s:if test="#session.USER_TYPE=='admin'">
				row.find("#edit").html(
						"<a href='editTask.jsp?userid=" + n.id + "'>编辑</a>");
				</s:if>
				$("#tasks").append(row);
			});
		});
	}
</script>
</head>

<body>
	<div class="container">

			<h1>任务列表</h1>
			<s:if test="#session.USER_TYPE=='admin'">
				<h2>
					<a href="addTask.jsp">添加任务</a>
				</h2>
			</s:if>

			<table id="tasks" border="1" cellspacing="0"
				style="border-collapse: collapse">
				<tr>
					<th>任务ID</th>
					<th>部门</th>
					<th>时间</th>
					<th>事由</th>
					<th>人员</th>
					<th>说明</th>
					<th>备注</th>
					<th>状态</th>
					<s:if test="#session.USER_TYPE=='admin'">
						<th>修改</th>
					</s:if>
				</tr>
				<tr id="taskList">
					<td id="id"></td>
					<td id="group"></td>
					<td id="datetime"></td>
					<td id="work"></td>
					<td id="workers"></td>
					<td id="info"></td>
					<td id="commont"></td>
					<td id="state"></td>
					<s:if test="#session.USER_TYPE=='admin'">
						<td id="edit"></td>
					</s:if>
				</tr>
			</table>
		</div>
</body>
</html>
